package cn.edu.nuc.wordsbook;

import android.database.Cursor;

public class Parse {

	public static WordsBook parseCursor(Cursor cursor) {

		if (null == cursor || 0 == cursor.getCount()) {
			return null;
		} else if (-1 == cursor.getPosition()) {
			cursor.moveToFirst();
		}

		WordsBook words = new WordsBook();
		words.id = cursor.getString(cursor.getColumnIndex(Constant.ID));
		words.english = cursor.getString(cursor
				.getColumnIndex(Constant.ENGLISH));
		words.translation = cursor.getString(cursor
				.getColumnIndex(Constant.TRANSLATION));
		words.lastDate = cursor.getString(cursor
				.getColumnIndex(Constant.LASTDATE));
		words.milldate = cursor.getLong(cursor.getColumnIndex(Constant.MILLDATE));
		return words;
	}

}
